package cn.com.w.dao.Service.Impl;

import cn.com.w.common.DTO.SysUserDTO;
import cn.com.w.dao.Service.ICommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

/**
 * @author w
 * @Description:
 * @DateTime: 2025 05 16 17:38
 **/
@Service
public class CommonServiceImpl implements ICommonService {

    private final HttpServletRequest request;

    @Autowired
    public CommonServiceImpl(HttpServletRequest request) {
        this.request = request;
    }

    @Override
    public SysUserDTO getSysUserDTO() {
        Object obj = request.getAttribute("USERINFO");
        if (null != obj && obj instanceof SysUserDTO) {
            return (SysUserDTO) obj;
//            return dto.getUsername();
        }
        return null;
    }
}